import http from "@/api";
import { PORT1 } from "@/api/config/servicePort";
import { AuthFuncMenu } from "@/api/interface/auth/funcMenu";
import { defaultParams } from "@/interface/public";

/**
 * @name 菜单功能
 */

// 查询系统下的功能菜单集合
export const funcMenuFindBySystem = (params: defaultParams) =>
  http.get<AuthFuncMenu.ResSearch[]>(PORT1 + `/funcMenu/findBySystem/${params.id}`);

// 保存一条功能菜单
export const funcMenuSave = (params: AuthFuncMenu.ReqSave) => http.post(PORT1 + `/funcMenu/save`, params);

// 删除
export const funcMenuRemove = (params: defaultParams) => http.post(PORT1 + `/funcMenu/remove/${params.id}`);

// 启用
export const funcMenuEnable = (params: defaultParams) => http.post(PORT1 + `/funcMenu/enable/${params.id}`);

// 禁用
export const funcMenuDisable = (params: defaultParams) => http.post(PORT1 + `/funcMenu/disable/${params.id}`);

// ------------------------------菜单字典----------------------------------

// 保存图标
export const funcDicSaveIcon = (params: AuthFuncMenu.ReqSaveIcon) => http.post(PORT1 + `/funcDic/saveIcon`, params);

// 保存路径
export const funcDicSavePath = (params: AuthFuncMenu.ReqSavePath) => http.post(PORT1 + `/funcDic/savePath`, params);

// 保存配置
export const funcDicSaveSet = (params: AuthFuncMenu.ReqSaveConfig) => http.post(PORT1 + `/funcDic/saveSet`, params);

// 查询图标列表
export const funcDicFindByIcon = () => http.get<AuthFuncMenu.ResIconSearch[]>(PORT1 + `/funcDic/findByIcon`);

// 查询路径列表
export const funcDicFindByPath = () => http.get<AuthFuncMenu.ResIconSearch[]>(PORT1 + `/funcDic/findByPath`);

// 查询配置列表
export const funcDicFindBySet = () => http.get<AuthFuncMenu.ResSearchConfig[]>(PORT1 + `/funcDic/findBySet`);

// 查询指定配置
export const funcDicFindSetByTitle = (params: { title: any }) =>
  http.get<AuthFuncMenu.ResSearchConfig>(PORT1 + `/funcDic/findSetByTitle`, params);

// 删除
export const funcDicRemove = (params: defaultParams) => http.post(PORT1 + `/funcDic/remove/${params.id}`);

// 启用
export const funcDicEnable = (params: defaultParams) => http.post(PORT1 + `/funcDic/enable/${params.id}`);

// 禁用
export const funcDicDisable = (params: defaultParams) => http.post(PORT1 + `/funcDic/disable/${params.id}`);
